<?php

namespace component\system\system_user_login;

use common\model\Model;

/**
 * Class SystemUserLoginModel
 * @package component\system\system_user_login
 * @property integer $id
 * @property integer $user_id
 * @property string $ip
 * @property string $agent
 * @property string $languages
 * @property string $device
 * @property string $browser
 * @property string $version_browser
 * @property string $platform
 * @property string $version_platform
 * @property integer $phone
 * @property string $robot
 * @property integer $create_time
 * @property integer $update_time
 * @property integer $delete_time
 */
class SystemUserLoginModel extends Model
{
    protected $table = 'system_user_login';

    protected $schema = [
        'id' => 'integer',
        'user_id' => 'integer',
        'ip' => 'string',
        'agent' => 'string',
        'languages' => 'string',
        'device' => 'string',
        'browser' => 'string',
        'version_browser' => 'string',
        'platform' => 'string',
        'version_platform' => 'string',
        'phone' => 'integer',
        'robot' => 'string',
        'create_time' => 'integer',
        'update_time' => 'integer',
        'delete_time' => 'integer',
    ];

    /**
     * @param $value
     * @return string
     */
    protected function setLanguagesAttr($value)
    {
        if ($value && is_array($value)) {
            $value = implode(',', $value);
        } else {
            $value = '';
        }

        return $value;
    }
}    